package net.example.model.event;

import com.oraycn.esframework.core.ClientType;
import com.oraycn.omcs.shortMessages.AudioMessage;

import net.example.model.common.ChatEventType;
import net.example.model.common.RichChatMessage;
import net.example.model.FileMessage;

import java.util.Date;

/**
 * Created by ZN on 2015/12/4.
 */
public class ChatEvent {
    public ChatEvent(){}
    public ChatEvent(String groupID, ClientType clientType, String sourceID, RichChatMessage msg, boolean isGroupChat) {
        this.msg = msg;
        this.type = ChatEventType.RichChatMessage;
        this.groupID = groupID;
        this.isGroupChat = isGroupChat;
        this.sourceID = sourceID;
        this.clientType = clientType;
    }

    public ChatEvent(String senderID, ClientType clientType, String sourceID, AudioMessage msg, boolean isGroupChat) {
        this.audioMessage = msg;
        this.type = ChatEventType.AudioMessage;
        this.groupID = senderID;
        this.isGroupChat = isGroupChat;
        this.sourceID = sourceID;
        this.clientType = clientType;
    }

    public ChatEvent(String senderID, ClientType clientType, String sourceID, FileMessage msg, boolean isGroupChat) {
        this.fileMessage = msg;
        this.type = ChatEventType.FileMessage;
        this.groupID = senderID;
        this.isGroupChat = isGroupChat;
        this.sourceID = sourceID;
        this.clientType = clientType;
    }

    public ChatEvent(String senderID, ClientType clientType, boolean isVibration) {
        this.isVibration = isVibration;
        this.type = ChatEventType.Vibration;
        this.groupID = senderID;
        this.sourceID = senderID;
        this.clientType = clientType;
    }

    public ClientType clientType;
    public ChatEventType type;
    public boolean isVibration;
    //组id（如果不是组消息，sourceID）接收者ID
    public String groupID;
    public RichChatMessage msg;
    public String ImageUrl;
    public AudioMessage audioMessage;
    public FileMessage fileMessage;
    public boolean isGroupChat;
    //发送者id
    public String sourceID;
    public boolean isSystemMsg=false;
    public boolean isEcho=false;//是否为自己本机发的或回声消息
    public String atMemberIDs; //消息@的对象ID 集合（英文逗号','分隔）
    public String snapchatMessageID ="";//阅后即焚消息ID

    public Date occurrenceTime = new Date();//消息发生时间
}

